package com.supersoul.myself.entity;

import com.supersoul.myself.entity.base.BaseEntity;
import jdk.nashorn.internal.ir.annotations.Immutable;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

/**
 * 分类实体类
 */
@Data
@Entity
@Table(name = "tb_category")
@SQLDelete(sql = "update tb_category set is_delete = 1 where id = ?")
public class Category extends BaseEntity {

    @Column(name = "cg_name ", nullable = false, length = 20)
    @NotEmpty
    @Size(max = 20, message = "cgName不能超过20个字")
    private String cgName;

    // 记录操作数据的人的信息,方便追踪
    // 操作人信息
    @Column(name = "creator_id", nullable = false, length = 64)
    @Size(max = 64, message = "creatorId不能超过64个字符")
    private String creatorId;

    @Column(name = "creator_name", nullable = false, length = 20)
    @Size(max = 20, message = "creatorName不能超过20个字符")
    public String creatorName;

    // 更新人信息
    @Column(name = "updator_id", length = 64)
    @Size(max = 64, message = "updatorId不能超过64个字符")
    public String updatorId;

    @Column(name = "updator_name", length = 20)
    @Size(max = 20, message = "updatorName不能超过20个字符")
    public String updatorName;
}
